package com.javaeedev.lightweight.mvc.sample.web;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.adam.framework.web.AbstractAction;
import com.javaeedev.lightweight.mvc.ActionContext;
import com.javaeedev.lightweight.mvc.Model;
import com.javaeedev.lightweight.mvc.sample.User;

/**
 * Home page.
 * 
 * @author Xuefeng
 */
public class StartAction extends AbstractAction {

    public Model execute() throws Exception {
        String username = (String) ActionContext.getActionContext().getSession().getAttribute("USER");
        List<User> users = facade.queryUsers();
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("users", users);
        map.put("username", username);
        return new Model("/start.html", map);
    }

}
